﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Weibo4Sharp.Model;
using Hammock.Web;

namespace Weibo4Sharp.Service
{
    public partial class WeiboService
    {
        public IEnumerable<WeiboTag> ListTags(long userId, int count = 20, int page = 1)
        {
            return WithHammock<IEnumerable<WeiboTag>>(
                "tags" + FormatAsString,
                "?source=" + _consumerKey,
                "&user_id=", userId,
                "&count=", count,
                "&page=", page);
        }

        public IEnumerable<WeiboTagId> CreateTags(IEnumerable<string> tags)
        {
            return WithHammock<IEnumerable<WeiboTagId>>(WebMethod.Post,
                "tags/create", FormatAsString,
                "?tags=", tags);
        }

        /// <summary>
        /// list suggested tags
        /// </summary>
        /// <param name="count">1 - 10</param>
        /// <returns></returns>
        public IEnumerable<WeiboTag> ListSuggestedTags(int count = 10)
        {
            return WithHammock<IEnumerable<WeiboTag>>(
                "tags/suggestions", FormatAsString,
                "?source=", _consumerKey,
                "&count=", count);
        }

        public WeiboResult DeleteTag(long tagId)
        {
            return WithHammock<WeiboResult>(WebMethod.Delete,
                "tags/destroy", FormatAsString,
                "?tag_id=", tagId);
        }

        public IEnumerable<WeiboTagId> DeleteTags(IEnumerable<object> ids)
        {
            return WithHammock<IEnumerable<WeiboTagId>>(WebMethod.Delete,
                "tags/destroy_batch", FormatAsString,
                "?ids=", ids);
        }
    }
}
